/*
 * @Author: zk
 * @Date: 2021-01-21 14:14:02
 * @LastEditors: zk
 * @LastEditTime: 2021-01-21 17:15:08
 * @Description:
 */
import MySelect from './form-item/MySelect.vue'
export default {
  name: 'ItemForm',
  model: {
    prop: 'value',
    event: 'change'
  },
  props: {
    type: {
      type: String,
      default: ''
    },
    label: {
      type: String,
      default: ''
    },
    options: {
      type: Array,
      default: () => []
    },
    value: {
      type: String,
      default: ''
    },
    prop: {
      type: String,
      default: ''
    }
  },
  render: function(h) {
    let vnodes = {}
    switch (this.type) {
      case 'Select':
        vnodes = (<MySelect prop={this.prop} label={this.label} options={this.options} prop={this.prop} value={this.value} onChange={(value) => this.$emit('change', value)}/>)
        break
      case 'Input':
        vnodes = (
          <el-input></el-input>
        )
        break
    }
    return vnodes
  }
}
